{% extends "sysadmin/base.html" %}
{% load seahub_tags i18n %}

{% block cur_users %}tab-cur{% endblock %}

{% block left_panel %}{{block.super}}
<form action="{% url 'user_search' %}" method="get" class="side-search-form">
    <input type="text" name="email" class="input" value="" placeholder="{% trans "Search users..." %}" />
</form>
{% endblock %}

{% block right_panel %}
<div class="tabnav">
    <ul class="tabnav-tabs">
        <li class="tabnav-tab"><a href="{% url 'sys_useradmin' %}">{% trans "Database" %}</a></li>
        <li class="tabnav-tab tabnav-tab-cur"><a href="{% url 'sys_useradmin_ldap' %}">{% trans "LDAP" %}</a></li>
        <li class="tabnav-tab"><a href="{% url 'sys_useradmin_ldap_imported' %}">{% trans "LDAP(imported)" %}</a></li>
        <li class="tabnav-tab"><a href="{% url 'sys_useradmin_admins' %}">{% trans "Admins" %}</a></li>
    </ul>
</div>

<table>
    <tr>
        <th width="40%">{% trans "Email" %}</th>
        <th width="35%">{% trans "Create At / Last Login" %}</th>
        <th width="25%">{% trans "Space Used" %}</th>
    </tr>

    {% for user in users %}
    <tr>
        <td data="{{user.id}}"><a href="{{ SITE_ROOT }}useradmin/info/{{ user.props.email }}/">{{ user.email }}</a></td>
        <td style="font-size:11px;"> -- / {% if user.last_login %}{{user.last_login|translate_seahub_time}} {% else %} -- {% endif %}
        </td>
        <td style="font-size:11px;">
            <p> {{ user.space_usage|filesizeformat }} {% if user.space_quota > 0 %} / {{ user.space_quota|filesizeformat }} {% endif %} </p>
            {% if not user.org %}
            {% if CALC_SHARE_USAGE %}
            <p> {{ user.share_usage|filesizeformat }} {% if user.share_quota > 0 %} / {{ user.share_quota|filesizeformat }} {% endif %} </p>
            {% endif %}
            {% endif %}
        </td>
    </tr>
    {% endfor %}
</table>

{% include "sysadmin/useradmin_paginator.html" %}
{% endblock %}

{% block extra_script %}
<script type="text/javascript">

</script>
{% endblock %}
